#include <ros/ros.h>
#include <tf/transform_broadcaster.h>

int main(int argc, char** argv)
{
	//初始化ROS节点
	ros::init(argc, argv, "tf_broadcaster");
	ros::NodeHandle n;
	
	//声明一个tf广播器
	tf::TransformBroadcaster br;
	
	while(ros::ok())
	{
		//创建坐标变换transform
		tf::Transform transform;
		//给定平移变换值
		transform.setOrigin(tf::Vector3(0.1, 0.0, 0.2));
		//给定旋转变换值，这里没有旋转变换，所以定义四元数时无需给定角度
		transform.setRotation(tf::Quaternion(0, 0, 0, 1));
		
		//广播器发布坐标变换
		br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "base_link", "base_laser"));
	}
	
	return 0;
}